package br.ufmg.ubicomp.droidguide;

import br.ufmg.ubicomp.droidguide.eventservice.EventNotificationService;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

public class DroidGuide extends Activity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		startServices();
	}

	private void startServices() {
		Log.e(this.getClass().getSimpleName(), "starting services . . .");
		try {
			Intent svc = new Intent(this, EventNotificationService.class);
			startService(svc);
		} catch (RuntimeException e) {
			e.printStackTrace();
			Log.e(this.getClass().getSimpleName(), "ui creation problem", e);
		}
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();

		// stop MyService
		{
			Intent svc = new Intent(this, EventNotificationService.class);
			stopService(svc);
		}

	}
}